<?php

namespace HelloAdmin\Model;

use Common\Model\XuecheModel;

class UserModel extends XuecheModel {

    protected $tableName = 'user';
    protected $pk = 'user_id';
    protected $fields = array(
        'user_id', 'username', 'password', 'last_time', 'remark', 'pass_account', 'disabled', 'email', 'createtime'
    );

//    protected $_map = array(
//        'member_id' => 'user_id',
//        'pass' => 'pass_account',
//    );

    /**
     * 清空数据缓存
     * 
     */
    public function ClearAllCache() {
        
    }

    //缓存设置
    protected $_useCacheType = 'file';
    protected $_catheTime = 36000;

    public function Validate($data) {
        if (!empty($data['password'])) {
            return TRUE;
        } else {
            //$this->getError = '';
        }
        return false;
    }


    public function checkRepeat($username) {
        if (empty($username)) { return FALSE;}
        $res = $this->where("`username` = '{$username}'")->find();
        if ($res) {
            return $res;
        }
        
        return FALSE;
    }
    
    public function GetDataByWhere($where = '', $order = '', $start = 0, $rows = 30, $fields = '', $hasCount = TRUE, $bigData = FALSE) {
        return parent::GetDataByWhere($where, $order, $start, $rows, $fields, $hasCount, $bigData);
    }

}
